package com.wsoft.config;

import com.wsoft.interceptor.FileUploadInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author z001
 * @Date 2024/10/15 18:25
 */
@Configuration
public class WebConfig  implements WebMvcConfigurer {

    @Autowired
    private FileUploadInterceptor fileUploadInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //配置上传自定义拦截器
        registry.addInterceptor(fileUploadInterceptor)
                //拦截所有路径
                .addPathPatterns("/**");
    }
}
